package elicecn.util;

import java.io.File;
import java.io.IOException;

public class DeleteFolder {
	private int count = 0;

	public void deleteFolder(File file) throws IOException {
		if (file.isDirectory()) {
			for (File subFile : file.listFiles()) {
				deleteFolder(subFile);
			}
		}
		if (file.getCanonicalPath().contains(".svn")
				|| file.getCanonicalPath().contains("Thumbs.db")
				|| (file.isDirectory() && file.listFiles().length == 0)) {
			file.delete();
			System.out.println(++count + " - " + file.getCanonicalPath()
					+ " - deleted");// 已删除文件
		}
	}

	public static void main(String[] args) throws IOException {
		new DeleteFolder().deleteFolder(new File("F:/dev/repos/"));
		System.out.println("That's all!");
	}
}
